<?php

require_once 'PHPUnit/Autoload.php';
require_once 'ArticleDao.php';

class ArticleDaoTest extends PHPUnit_Extensions_Database_TestCase {
	public function getDataSet() {
		return $this->createXMLDataSet('seed.xml');
	}

	public function getConnection() {
		$pdo = new PDO(
			"mysql:host=localhost;dbname=nettuts", 
			"root", 
			"password"
		);
		return $this->createDefaultDBConnection($pdo, 'nettuts');	
	}

	public function testGetArticlesNonHomeNoArticles() {
                $articleDao = new ArticleDaoImpl();
		$articles = $articleDao->getArticles(2, false);
                $this->assertEquals(
                        array(

                        ),
                $articles);

        }
	
	public function testGetArticlesNonHome() {
                $articleDao = new ArticleDaoImpl();
		$articles = $articleDao->getArticles(1, false);
                $this->assertEquals(array(
                        array(
                                'id' => 1,
                                'title' => 'Android vs iOS',
                        ),
                        array(
                                'id' => 2,
                                'title' => 'Android vs Wp7'
                        ),
                        array(
                                'id' => 3,
                                'title' => 'iOS 5'
                        )
                ),
                $articles);

        }
}
